package com.shierke.Ume.ui.activity.message

import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.widget.ImageView
import android.widget.TextView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CircleCrop
import com.bumptech.glide.request.RequestOptions
import com.shierke.Ume.R
import com.shierke.Ume.base.BaseActivity
import com.shierke.Ume.util.startActivity
import kotlinx.android.synthetic.main.activity_chart_main.*
import kotlinx.android.synthetic.main.item_message_list.view.*

/**
 * Create by Ybx
 * on 2020-10-20
 * Desribe:
 */
class ChatMainActivity : BaseActivity() {


    companion object {
        fun startActivity(context: Context) {
            context.startActivity<ChatMainActivity>()
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.activity_chart_main)

        setActivityTitleText("name")

        val title = LayoutInflater.from(this).inflate(R.layout.item_chat_title_mate, null, false)

        val imageView = title.findViewById<ImageView>(R.id.head1)
        val imageView1 = title.findViewById<ImageView>(R.id.head2)

        Glide.with(this)
            .load(R.mipmap.search_result_head)
            .apply(RequestOptions.bitmapTransform(CircleCrop()))
            .into(imageView)

        Glide.with(this)
            .load(R.mipmap.search_result_head)
            .apply(RequestOptions.bitmapTransform(CircleCrop()))
            .into(imageView1)

        chartList.addView(title)


        val hint = LayoutInflater.from(this).inflate(R.layout.item_chart_hint, null, false)
        chartList.addView(hint)


        val time = LayoutInflater.from(this).inflate(R.layout.item_chat_time, null, false)
        chartList.addView(time)


        val personTv =
            LayoutInflater.from(this).inflate(R.layout.item_chat_person_text, null, false)
        val imageView2 = personTv.findViewById<ImageView>(R.id.head)
        val content = personTv.findViewById<TextView>(R.id.content)
        content.text = "Don't send your whatspp id to each others, so as not to be deceived."
        Glide.with(this)
            .load(R.mipmap.search_result_head)
            .apply(RequestOptions.bitmapTransform(CircleCrop()))
            .into(imageView2)

        chartList.addView(personTv)


        val myTV = LayoutInflater.from(this).inflate(R.layout.item_chat_my_text, null, false)
        val imageView3 = myTV.findViewById<ImageView>(R.id.head)
        val content2 = myTV.findViewById<TextView>(R.id.content)

        content2.text = "Don't send your whatspp id to each others, so as not to be deceived."
        Glide.with(this)
            .load(R.mipmap.search_result_head)
            .apply(RequestOptions.bitmapTransform(CircleCrop()))
            .into(imageView3)
        chartList.addView(myTV)


    }
}